package com.doubao.doubao_admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doubao.doubao_admin.model.entity.UmsUser;
import com.doubao.doubao_admin.model.vo.ProfileVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Component
@Repository
public interface UmsUserMapper extends BaseMapper<UmsUser> {
    @Insert("INSERT INTO `ums_user`(username,password,create_time,modify_time) VALUES(#{username},#{password},#{create_time},#{modify_time})")
    int addUser(UmsUser user);
    @Select("SELECT * FROM `ums_user` WHERE username = #{username}")
    UmsUser queryByUsername(String username);
    @Select("SELECT * FROM `ums_user` WHERE username = #{username}")
    List<UmsUser> queryByUsers(String username);
    /**
     * 获取用户信息
     *
     * @param id 用户ID
     * @return
     */
    @Select("SELECT * FROM `ums_user` WHERE id = #{id}")
    ProfileVO getUserProfile(String id);
}
